package com.gy.universities.service.impl;
import com.gy.universities.dao.StudySctypeMapper;
import com.gy.universities.entity.StudySctype;
import com.gy.universities.service.StudySctypeService;
//import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;

@Component
@Service
public class StudySctypeServiceImpl implements StudySctypeService {

    @Resource
    private StudySctypeMapper studySctypeMapper;

    public StudySctype getStudySctypeById(String id)throws Exception{
        return studySctypeMapper.getStudySctypeById(id);
    }

    public List<StudySctype>	getStudySctypeListByMap(Map<String,Object> param)throws Exception{
        return studySctypeMapper.getStudySctypeListByMap(param);
    }

    public Integer getStudySctypeCountByMap(Map<String,Object> param)throws Exception{
        return studySctypeMapper.getStudySctypeCountByMap(param);
    }

    public Integer qdtxAddStudySctype(StudySctype studySctype)throws Exception{
            //studySctype.setCreatedTime(new Date());
            return studySctypeMapper.insertStudySctype(studySctype);
    }

    public Integer qdtxModifyStudySctype(StudySctype studySctype)throws Exception{
        //studySctype.setUpdatedTime(new Date());
        return studySctypeMapper.updateStudySctype(studySctype);
    }

    public Integer qdtxDeleteStudySctypeById(String id)throws Exception{
        return studySctypeMapper.deleteStudySctypeById(id);
    }

    public Integer qdtxBatchDeleteStudySctype(String ids)throws Exception{
        Map<String,List<String>> param=new HashMap<String,List<String>>();
        String[] paramArrays=ids.split(",");
        List<String> idList=new ArrayList<String>();
            for (String temp:paramArrays){
                idList.add(temp);
            }
        param.put("ids",idList);
        return studySctypeMapper.batchDeleteStudySctype(param);
    }


}
